from django.test import TestCase

# Create your tests here.

import json
import requests
import sys

def send_msg(url):
    headers = {'Content-Type': 'application/json;charset=utf-8'}
    data = {
        "msgtype": "link",
        "link": {
            "text":"接口测试",
            "title": "api",
            # "picUrl": "图片连接",
            "messageUrl": "http://39.108.67.243:8080/job/api_test/"
        }
    }
    r = requests.post(url,data = json.dumps(data),headers=headers)
    return r.text
if __name__ == '__main__':
    url = 'https://oapi.dingtalk.com/robot/send?access_token=117728a15398d29528a96b2fe7c2d4b916d83a4c38d92bddda9d72e808f469f3'                #此处为丁丁机器人的地址，参考技术手册创建
    print(send_msg(url))
